<?php
/**
 * EntrancePoint for Embrace Bug Tracker
 * 
 * EBT is an ticket-based AJAX BugTracking Tool for software development. 
 */
require_once("config/config.php");
$ebt = new EmbraceBugTracker($_SERVER["DOCUMENT_ROOT"] . "/ebt/config/");

?>
<html>
	<head>
		<title>Embrace Bug Tracker - 0.0.1</title>
		<link rel="stylesheet" type="text/css" href="<?php echo $ebt->getRoot();?>/style/basic.css"></link>
		<!-- <script src="/external/javascript/prototype.js"></script> -->
		
		<!-- <script src="/eui/eui.js.php?debug&nogzip"></script> -->
		<script src="/eui/eui.js.php"></script>
		<script type="text/javascript">
			document.observe("dom:loaded", function() {
				var menuBar = new eui.MenuBar("menu");
				var tabSystem = new eui.TabSystem({element: "tabSystem"});
				var tabs = $A();
				tabs.startpage = new eui.TabSystem.Tab("Start", "/ebt/content/startPage.php");
				tabs.projects = new eui.TabSystem.Tab("Projects", "/ebt/content/projects.php");
				tabs.tickets = new eui.TabSystem.Tab("Tickets", "/ebt/content/tickets.php");
				tabs.settings = new eui.TabSystem.Tab("Settings", "/ebt/content/settings.php");

				$("menu").observe("menu:clicked", function(menuClicked){
					if(
						menuClicked.eventName && 
						menuClicked.memo &&
						menuClicked.memo.show != "help"
					) {
						tabSystem.showTab(tabs[menuClicked.memo.show]);
					}else if(
						menuClicked.eventName && 
						menuClicked.memo &&
						menuClicked.memo.show == "help"
					) {
						console.log("Help start");
					} else {
						throw("MenuException: Unable to get menuItem data.");
					}
				});

				$("tabSystem").observe("tab:loaded", function(tabEvent) {
					$$(".tree").each(function(item) {
						try {
							new eui.TreeView.TreeView({ element: item });
						}catch(exc) {
							console.error("Exc %o", exc);
						}
					});
				});
			});
		</script>
	</head>
	
	<body>
		<div id="application">
			<div id="head">
				<h1>Embrace Bug Tracker</h1>
			</div>
			<div id="menu">
 				<ul>
 					<li><span class="menuItem" menuItem="startpage">Start</span></li>
 					<li><span class="menuItem" menuItem="projects">Projects</span></li>
 					<li><span class="menuItem"  menuItem="tickets">Tickets</span></li>
 					<li><span class="menuItem" menuItem="settings">Settings</span></li>
 					<li><span class="menuItem" menuItem="help">Help</span></li>
 				</ul>
			</div>
			<div id="tabSystem">
				<div id="tabs">
					<ul>
					</ul>
				</div>
				<div id="tabContent"></div>
			</div>
			<div id="footer">
				<center>&copy; 2009 Embrace.Toolkit</center>
			</div>
		</div>
	</body>
</html>